

use "$data/clean/clean_main_complete.dta" , replace


********************************************************************************


global control z_voice_prior  female age member member_years d_experience_campaign   z_votes_own z_votes_other_1 z_votes_other_2  pre_doortodoor pre_days_doortodoor pre_posters pre_booth pre_online pre_call pre_friends pre_others 
		   
loc experiments "any_doors doors_wins "

		   
		   
preserve

clear all
eststo clear
estimates drop _all

set obs 10
qui gen x = 1
qui gen y = 1

loc columns = 0

foreach choice in `experiments' `experiments'{

    loc ++columns
    qui eststo col`columns': reg x y

}

restore


/* Statistics */

loc colnum = 1
loc colnames ""


foreach choice in `experiments' {

/* Statistics */



 
 
********************************Panel A*****************************************
	
 xi: reg `choice'  int_doortodoor , vce(r) // 
   
   
   
    sigstar int_doortodoor  , prec(3)
    estadd loc thisstat3 = "`r(bstar)'": col`colnum'
    estadd loc thisstat4 = "`r(sestar)'": col`colnum'
   
		 
	qui sum `choice' if control==1
	estadd loc thisstat6 = string(`r(mean)', "%9.2f"): col`colnum'
	
	qui sum `choice' 
    estadd loc thisstat7 = string(`r(N)', "%9.0f"): col`colnum'
	
	
 xi: reg `choice'  int_doortodoor $control , vce(r) // 
   
      loc ++colnum
   
    sigstar int_doortodoor  , prec(3)
    estadd loc thisstat3 = "`r(bstar)'": col`colnum'
    estadd loc thisstat4 = "`r(sestar)'": col`colnum'
   
		 
	qui sum `choice' if control==1
	estadd loc thisstat6 = string(`r(mean)', "%9.2f"): col`colnum'
	
	qui sum `choice' 
    estadd loc thisstat7 = string(`r(N)', "%9.0f"): col`colnum'	
	
    estadd loc thisstat8 = "X": col`colnum'	
	
    loc ++colnum

	}
	

	 

loc rowlabels " " " "  " "Intention: Any canvassing" " " "  "  "\hline Control mean" "Number of Observations" "Control variables" "

loc rowstats ""

forval i = 1/8 {
    loc rowstats "`rowstats' thisstat`i'"
}



esttab col* using "$output/corr_doors_int.tex", replace cells(none) booktabs nonotes compress alignment(c) nomtitle nogap noobs nobaselevels label stats(`rowstats', labels(`rowlabels')) ///
  mgroups("Any door"  "Doors (wins)",  pattern(1 0 1 0 ) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) //  mtitle("Any" "Days" "Doors (wins)"  )


